﻿using System.Windows;

namespace RssReader
{
  public class WebBrowserHelper
  {
    public static readonly DependencyProperty BodyProperty = DependencyProperty.RegisterAttached("Body", typeof(string), typeof(WebBrowserHelper), new PropertyMetadata(OnBodyChanged));

    public static string GetBody(DependencyObject dependencyObject)
    {
      return (string)dependencyObject.GetValue(BodyProperty);
    }

    public static void SetBody(DependencyObject dependencyObject, string body)
    {
      dependencyObject.SetValue(BodyProperty, body);
    }

    private static void OnBodyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
      // Blows here because the Webbrowser control isn't loaded yet

      //var webBrowser = (WebBrowser)d;
      //webBrowser.NavigateToString((string)e.NewValue);
    }
  }

}
